import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "../views/Layout/index.vue";

const Dashboard = () => import("../views/Dashboard/Dashboard.vue");
const System = () => import("../views/Dashboard/System.vue");
const Task = () => import("../views/Task/Task.vue");
const Edit = () => import("../views/Task/Edit.vue");
const Control = () => import("../views/Task/Control.vue");
const Homework = () => import("../views/Task/Homework.vue");
const Source = () => import("../views/Source/Source.vue");
const Map = () => import("../views/Source/Map.vue");
const Data = () => import("../views/Source/Data.vue");
const Log = () => import("../views/Source/Log.vue");
const Manage = () => import("../views/Manage/Manage.vue");
const Device = () => import("../views/Manage/Device.vue");
const MapEdit = () => import("../views/MapEdit/index.vue");
const MapEditor = () => import("../views/MapEdit/MapEdit.vue");
const LeafLet = () => import("../views/MapEdit/LeafLet.vue");
const WebRTCIndex = () => import("../views/WebRTC/index.vue");
const WebRTC = () => import("../views/WebRTC/WebRTC.vue");
const Publisher = () =>import("../views/WebRTC/publisher.vue")
const Video = () => import("../views/Video/index.vue");
const RosMap = () => import("../views/RosMap/index.vue");
// 新增：系统管理相关组件导入
const SystemManagement = () => import("../views/SystemManagement/index.vue");
const MenuManagement = () => import("../views/SystemManagement/MenuManagement.vue");
const UserManagement = () => import("../views/SystemManagement/UserManagement.vue");
const DepartmentManagement = () => import("../views/SystemManagement/DepartmentManagement.vue");
Vue.use(VueRouter);

const routes = [
  {
    path: "",
    component: Layout,
    redirect: "/dashboard",
    children: [
      {
        path: "/dashboard",
        name: "Dashboard",
        component: Dashboard,
        redirect: "/dashboard/system",
        children: [
          {
            path: "system",
            name: "system",
            component: System,
          },
        ],
      },
      {
        path: "/task",
        name: "Task",
        component: Task,
        redirect: "/task/homework",
        children: [
          {
            path: "homework",
            name: "homework",
            component: Homework,
          },
          {
            path: "edit",
            name: "edit",
            component: Edit,
          },
          {
            path: "control",
            name: "control",
            component: Control,
          },
        ],
      },
      {
        path: "/source",
        name: "Source",
        component: Source,
        redirect: "/source/map",
        children: [
          {
            path: "map",
            name: "map",
            component: Map,
          },
          {
            path: "data",
            name: "data",
            component: Data,
          },
          {
            path: "log",
            name: "log",
            component: Log,
          },
        ],
      },
      {
        path: "/manage",
        name: "Manage",
        component: Manage,
        redirect: "/manage/device",
        children: [
          {
            path: "device",
            name: "device",
            component: Device,
          },
        ],
      },
      {
        path: "/mapedit",
        name: "MapEdit",
        component: MapEdit,
        redirect: "/mapedit/mapeditor",
        children: [
          {
            path: "mapeditor",
            name: "mapeditor",
            component: MapEditor,
          },
          {
            path: "leaflet",
            name: "leaflet",
            component: LeafLet,
          },
        ],
      },
      {
        path: "/webrtcIndex",
        name: "WebRTCIndex",
        component: WebRTCIndex,
        redirect: "/webrtcIndex/webrtc",
        children: [
          {
            path: "webrtc",
            name: "webrtc",
            component: WebRTC,
          },
          {
            path:"publisher",
            name:"publisher",
            component:Publisher,
          }
        ],
      },
      {
        path: "/video",
        name: "Video",
        component: Video,
        
      },
      {
        path: "/rosmap",
        name: "RosMap",
        component: RosMap,
      },
      // 新增：系统管理路由配置
      {
        path: "/systemManagement",
        name: "SystemManagement",
        component: SystemManagement,
        redirect: "/systemManagement/menuManagement",
        children: [
          {
            path: "menuManagement",
            name: "menuManagement",
            component: MenuManagement,
          },
          {
            path: "userManagement",
            name: "userManagement",
            component: UserManagement,
          },
          {
            path: "departmentManagement",
            name: "departmentManagement",
            component: DepartmentManagement,
          },
        ],
      }
    ],
  },
];

const router = new VueRouter({
  routes,
});


export default router;
